def Quick_Sort(List):
    # 加一个判定，长度不够的话直接返回list
    if len(List) < 2:
        return List
    else:
        # 递归条件
        pivot = List[0]
        # 所有小于pivot的元素放到左边
        less = [i for i in List[1:] if i <= pivot]
        # 所有大于pivot的元素放到右边
        greater = [i for i in List[1:] if i > pivot]
        # 递归，不断重新定义pivot
        return Quick_Sort(less) + [pivot] + Quick_Sort(greater)


print(Quick_Sort([10, 5, 2, 3, 4, 86, 9]))
